package edu.xlh.travel.controller.admin;

import edu.xlh.travel.common.Result;
import edu.xlh.travel.pojo.Hotel_orders;
import edu.xlh.travel.pojo.querypojo.QueryOrders;
import edu.xlh.travel.service.ForeHotelOrderService;
import edu.xlh.travel.service.HotelService;
import edu.xlh.travel.syslog.annontion.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/hotelOrder")
public class HotelOrderController {
    @Autowired
    private ForeHotelOrderService foreHotelOrderService;

    @Log("跳转酒店订单列表页面")
    @RequestMapping("/hotelOrderList")
    public String ordersList() {
        return "admin/ordersmanage/hotelOrderList";
    }

    @Log("查询所有酒店订单")
    @RequestMapping("/findAllHotelOrderForAdmin")
    @ResponseBody
    public Result findAllHotelOrderForAdmin(int page, int limit , HttpSession session) {
        return foreHotelOrderService.findAll(page , limit , session);
    }

    /*
     * query hotel orders by condition
     * */
    @Log("条件模糊查询酒店订单")
    @RequestMapping("/QueryHotelOrdersByCondition")
    @ResponseBody
    public Result  QueryHotelOrdersByCondition(Integer page, Integer limit, QueryOrders queryOrders , HttpSession session) {
        return foreHotelOrderService.QueryHotelOrdersByCondition(page , limit ,queryOrders , session);
    }

    /*
    * arrangeAccommodation 安排入住
    * */
    @Log("安排入住")
    @RequestMapping("/arrangeAccommodation/{id}")
    @ResponseBody
    public Result arrangeAccommodation(@PathVariable("id")String id , @RequestBody Hotel_orders hotel_orders ,  HttpSession session) {
        return foreHotelOrderService.arrangeAccommodation(id , hotel_orders ,  session);
    }
}
